package com.android.job.ui;

import com.android.job.fusion.FusionCode;
import com.android.job.logic.LoginLogic;
import com.android.job.logic.SearchJobLogic;
import com.android.job.logic.SearchResumeLogic;
import com.android.job.logic.UpdateVerLogic;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class TestAPI extends Activity implements OnClickListener
{
	private Button loginBtn;
	private Button regisgterBtn;
	private Button possearchBtn;
	private Button peoplesearchBtn;
	private Button verupdateBtn;

	private TextView jsonTV;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test);
		initLayout();

	}

	private void initLayout()
	{
		loginBtn = (Button) findViewById(R.id.login);
		regisgterBtn = (Button) findViewById(R.id.register);
		possearchBtn = (Button) findViewById(R.id.job_pos_search);
		peoplesearchBtn = (Button) findViewById(R.id.people_search);
		verupdateBtn = (Button) findViewById(R.id.version_update);

		loginBtn.setOnClickListener(this);
		regisgterBtn.setOnClickListener(this);
		possearchBtn.setOnClickListener(this);
		peoplesearchBtn.setOnClickListener(this);
		verupdateBtn.setOnClickListener(this);

		jsonTV = (TextView) findViewById(R.id.return_json);
	}

	private Handler handler = new Handler()
	{

		public void handleMessage(Message msg)
		{
			switch (msg.what)
			{
				case FusionCode.RETURN_JSONOBJECT:
					String json = (String) msg.obj;
					jsonTV.setText(json);
					Log.d("json", "json----------->"+json);
					break;

				default:
					break;
			}
			
		};

	};

	@Override
	public void onClick(View v)
	{
		switch (v.getId())
		{
			case R.id.login:
               LoginLogic.getInstance().login(handler, "", "");
				break;
			case R.id.register:
				break;
			case R.id.job_pos_search:
//				SearchJobLogic.getInstance().searchJob(handler, salary, region, type, degree, publish, begin);
				break;
			case R.id.people_search:
//				SearchResumeLogic.getInstance().searchResume(handler, salary, region, type, degree, updated, begin);
				break;
			case R.id.version_update:
//				UpdateVerLogic.getInstance().updateVer(handler, version, clientType);
				break;
			default:
				break;
		}
	}

}
